package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.DynamicSecondaryReview;
import cn.wolfcode.trip.base.service.IDynamicSecondaryReviewService;
import cn.wolfcode.trip.base.util.JSONResult;
import jdk.nashorn.internal.objects.annotations.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/dynamicSecondaryReview")
public class DynamicSecondaryReviewController {
    @Autowired
    private IDynamicSecondaryReviewService dynamicSecondaryReviewService;

    /**
     * 按页返回动态对应的评论
     */
    @GetMapping
    public List getReviewsByPage(Long[] commentIds){
        return dynamicSecondaryReviewService.getListByDynamicIds(commentIds);
    }

    /**
     * 新增一条评论
     * @param dynamicSecondaryReview
     * @return
     */
    @PostMapping
    public JSONResult save(DynamicSecondaryReview dynamicSecondaryReview){
        dynamicSecondaryReviewService.save(dynamicSecondaryReview);
        return new JSONResult();
    }

}